package de.pelizaeus.app;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.manuelpeinado.fadingactionbar.FadingActionBarHelper;

public class RaumplanShowActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        Character character = intent.getCharExtra(GebaeudeFragment.EXTRA_MESSAGE,'0');
        if (character == '0')
        {
            Toast.makeText(this, "Hilfe!!!", Toast.LENGTH_LONG).show();
            finish();
        }
        FadingActionBarHelper helper = new FadingActionBarHelper()
                .actionBarBackground(new ColorDrawable(getResources().getColor(R.color.action_bar)));
        switch (character)
        {
            case 'a':
                helper.headerLayout(R.layout.gebaeude_a_header)
                      .contentLayout(R.layout.gebaeude_a_scrollview);
                setContentView(helper.createView(this));
                helper.initActionBar(this);
                setTitle("A-Gebäude");
                break;
            case 'b':
                helper.headerLayout(R.layout.gebaeude_b_header)
                        .contentLayout(R.layout.gebaeude_b_scrollview);
                setContentView(helper.createView(this));
                helper.initActionBar(this);
                setTitle("B-Gebäude");
                break;
            case 'c':
                helper.headerLayout(R.layout.gebaeude_c_header)
                        .contentLayout(R.layout.gebaeude_c_scrollview);
                setContentView(helper.createView(this));
                helper.initActionBar(this);
                setTitle("C-Gebäude");
                break;
            case 'k':
                helper.headerLayout(R.layout.gebaeude_k_header)
                        .contentLayout(R.layout.gebaeude_k_scrollview);
                setContentView(helper.createView(this));
                helper.initActionBar(this);
                setTitle("K-Gebäude");
                break;
            case 'm':
                helper.headerLayout(R.layout.gebaeude_m_header)
                        .contentLayout(R.layout.gebaeude_m_scrollview);
                setContentView(helper.createView(this));
                helper.initActionBar(this);
                setTitle("Mensa");
                break;
            case 's':
                helper.headerLayout(R.layout.gebaeude_s_header)
                        .contentLayout(R.layout.gebaeude_s_scrollview);
                setContentView(helper.createView(this));
                helper.initActionBar(this);
                setTitle("Sporthalle");
                break;
        }
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.gebaeude_show, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a_gebaeude parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
